<!doctype html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>文件上传组件</title>
	<link rel="stylesheet" href="<?= APP_ROOT ?>static/view/manage/layui/css/layui.css">
	<link href="<?= APP_ROOT ?>static/view/manage/css/lib-app.css" rel="stylesheet" type="text/css" />
</head>

<body>
	<form enctype="multipart/form-data" method="post" name="upform">
		<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" id="upload-size">
			<i class="layui-icon"></i>浏览文件
		</button>
		<button type="submit" class="layui-btn layui-btn-sm" id="test-upload-size">上传</button>
		<input class="layui-upload-file" type="file" id="filename" accept="" name="filename[]">
		<div class="layui-inline layui-word-aux" id="tips"></div>
	</form> 

	<script type="text/javascript">
		function onBack(name, val) {
			parent.document.getElementById(name).value = val;
			parent.document.getElementById('s_'+name).innerHTML = '附件地址：<a href="/static/'+ val +'" targer="_blank">/static/'+ val +'</a>';
		}
	
		document.getElementById('upload-size').onclick = function() {
			document.getElementById('filename').click();
		}
	
		document.getElementById('filename').onchange = function() {
			document.getElementById('tips').innerHTML = document.getElementById('filename').value;
		}
	</script>
</body>
</html>